package com.bee.bootstrap.formDesign.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;

@TableName("core_form_data")
@Data
public class FormData extends Model<FormData> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value="id", type= IdType.ID_WORKER)
    private Long id;

    /**
     * 表单类型
     * @return
     */
    @NotBlank(message = "表单元素不能为空")
    @TableField("element")
    private String element;
    /**
     * 表单label
     * @return
     */
    @NotBlank(message = "表单label不能为空")
    @TableField("label")
    private String label;

    /**
     * 表单name属性
     * @return
     */
    @NotBlank(message = "表单name属性不能为空")
    @TableField("name")
    private String name;

    /**
     * 表单value属性
     * @return
     */
    @TableField("value")
    private String value;
    /**
     * 数据字典值
     * @return
     */
    @TableField("dictionary_id")
    private Long dictionaryId;
    /**
     * 表单记录Id
     * @return
     */
    @NotBlank(message = "表单记录Id不能为空")
    @TableField("form_record_id")
    private Long formRecordId;

    /**
     * 附加属性
     * @return
     */
    @TableField("additional")
    private  String additional;

    private transient Object valueView;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public FormData() {
    }
}
